import axios from '@/request/http'
import { commonOutDTO, pageCommonInputDTO, pageCommonOutDTO } from '@/api/common.d'
import {
  JzsmListInputDTO,
  JzsmListOutputDTO,
  addJzsmjlInputDTO,
  addJzsmjlOutputDTO,
  receiveInputDTO,
  thJzsmclInputDTO,
  thJzsmclOutputDTO,
  ghJzsmclInputDTO,
  updateJzsmwcInputDTO,
  GhjzsmListInputDTO,
  GhjzsmListOutputDTO,
  AjxxlbInputDTO,
  AjxxlbOutputDTO,
  GdsmbOutputDTO,
  sdjsJzsmInputDTO,
  SmcljjdInputDTO,
} from './jzsm-dto'

export default class dlglService {
  /**
   * 获取集中扫描列表
   */
  static queryJzsmList(
    data: pageCommonInputDTO<JzsmListInputDTO>,
  ): Promise<commonOutDTO<pageCommonOutDTO<JzsmListOutputDTO[]>>> {
    return axios.post('/api/gdgl/queryJzsmList', data)
  }

  /**
   * 新增集中扫描记录（申请集中扫描）
   */
  static addJzsmjl(data: addJzsmjlInputDTO): Promise<commonOutDTO<addJzsmjlOutputDTO>> {
    return axios.post('/api/gdgl/addJzsmjl', data)
  }

  /**
   * 接收集中扫描材料
   */
  static receiveJzsmcl(data: receiveInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/gdgl/receiveJzsmcl', data)
  }

  /**
   * 退回集中扫描材料
   */
  static thJzsmcl(data: thJzsmclInputDTO): Promise<commonOutDTO<thJzsmclOutputDTO>> {
    return axios.post('/api/gdgl/thJzsmcl', data)
  }

  /**
   * 归还集中扫描材料
   */
  static ghJzsmcl(data: ghJzsmclInputDTO): Promise<commonOutDTO<thJzsmclOutputDTO>> {
    return axios.post('/api/gdgl/ghJzsmcl', data)
  }

  /**
   * 集中扫描完成
   */
  static updateJzsmwc(data: updateJzsmwcInputDTO): Promise<commonOutDTO<thJzsmclOutputDTO>> {
    return axios.post('/api/gdgl/updateJzsmwc', data)
  }

  /**
   * 查询可归还集中扫描
   */
  static queryGhjzsmList(data: GhjzsmListInputDTO): Promise<commonOutDTO<GhjzsmListOutputDTO>> {
    return axios.post('/api/gdgl/queryGhjzsmList', data)
  }

  /**
   * 根据部门受案号查询案件信息
   */
  static queryAjxxlbbybmsah(data: AjxxlbInputDTO): Promise<commonOutDTO<AjxxlbOutputDTO[]>> {
    return axios.post('/api/gdgl/queryAjxxlbbybmsah', data)
  }

  /**
   * 集中扫描-查询归还集中扫描信息
   */
  static queryGdsmbybmsahList(data: AjxxlbInputDTO): Promise<commonOutDTO<GdsmbOutputDTO[]>> {
    return axios.post('/api/gdgl/queryGdsmbybmsahList', data)
  }

  /**
   * 手动接收集中扫描
   */
  static sdjsJzsm(data: sdjsJzsmInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/gdgl/sdjsJzsm', data)
  }

  /**
   * 获取扫描材料交接单序号
   */
  static getSmcljjdxh(data: SmcljjdInputDTO): Promise<commonOutDTO<string>> {
    return axios.post('/api/gdgl/getSmcljjdxh', data)
  }

  /**
   * 获取扫描材料交接单
   */
  static getSmcljjd(data: any): Promise<any> {
    return axios.get(
      data.qsrdzqmwjxh
        ? `/api/gdgl/getSmcljjd?smcljjdxh=${data.smcljjdxh}&dwmc=${data.dwmc}&qsrdzqmwjxh=${data.qsrdzqmwjxh}`
        : `/api/gdgl/getSmcljjd?smcljjdxh=${data.smcljjdxh}&dwmc=${data.dwmc}`,
      {
        responseType: 'blob',
      },
    )
  }
}
